Feature Group
bash internal / shell configuration and customization (7)
2
bash
This configures Bash shell options for safer scripting by preventing file overwriting, exiting on errors, revealing pipeline failures, and exposing unset variables.
set -o noclobber # Avoid overlay files (echo "hi" > foo) set -o errexit # Used to exit upon error, avoiding cascading errors set -o pipefail # Unveils hidden failures set -o nounset # Exposes unset variables
bash internalshell configuration and customizationstrict mode
5
bash
This demonstrates various Bash shell options (shopt
) for controlling globbing behavior, including case-insensitivity, recursive matching, and handling of non-matching patterns.
shopt -s nullglob # Non-matching globs are removed ('*.foo' => '') shopt -s failglob # Non-matching globs throw errors shopt -s nocaseglob # Case insensitive globs shopt -s dotglob # Wildcards match dotfiles ("*.sh" => ".foo.sh") shopt -s globstar # Allow ** for recursive matches ('lib/**/*.rb' => 'lib/a/b/c.rb')
bash internalshell configuration and customizationglobbing options
6
bash
This enhances the Bash shell experience by customizing the cd
command to list directory contents and creating aliases for common commands with interactive or human-readable options.
function cd { builtin cd "$@" && ls } alias cp='cp --interactive' alias mv='mv --interactive' alias rm='rm --interactive' alias df='df -h' alias du='du -h'
bash internalshell configuration and customizationaliases and functions